package org.fuys.etp.core.metrics;

import org.fuys.etp.core.metrics.impl.info.BaseInfoHandler;
import org.fuys.etp.core.metrics.impl.trend.AdaptiveTrendHandler;
import org.fuys.etp.core.metrics.impl.trend.StageSwitchTrendHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * @projectName: fuys-etp-final
 * @package: org.fuys.etp.core.metrics
 * @className: EtpMetricsHandlerChainConfig
 * @author: WangJing
 * @description: TODO
 * @date: 2025/2/20 20:30
 * @version: 1.0
 */
@Configuration
public class EtpMetricsHandlerChainConfig {

    @Resource
    private BaseInfoHandler baseInfoHandler;

    @Resource
    private StageSwitchTrendHandler stageSwitchTrendHandler;

    @Resource
    private AdaptiveTrendHandler adaptiveTrendHandler;

    @Bean
    public EtpMetricsHandlerChain defaultAdaptiveMetricsHandlerChain(){
        EtpMetricsHandlerChain defaultAdaptiveMetricsHandlerChain = new EtpMetricsHandlerChain();
        defaultAdaptiveMetricsHandlerChain.addMetricsHandler(baseInfoHandler);
        defaultAdaptiveMetricsHandlerChain.addMetricsHandler(adaptiveTrendHandler);
        return defaultAdaptiveMetricsHandlerChain;
    }

    @Bean
    public EtpMetricsHandlerChain defaultStageSwitchMetricsHandlerChain(){
        EtpMetricsHandlerChain defaultStageSwitchMetricsHandlerChain = new EtpMetricsHandlerChain();
        defaultStageSwitchMetricsHandlerChain.addMetricsHandler(baseInfoHandler);
        defaultStageSwitchMetricsHandlerChain.addMetricsHandler(stageSwitchTrendHandler);
        return defaultStageSwitchMetricsHandlerChain;
    }

    @Bean
    public EtpMetricsHandlerChain defaultCommonMetricsHandlerChain(){
        EtpMetricsHandlerChain commonMetricsHandlerChain = new EtpMetricsHandlerChain();
        commonMetricsHandlerChain.addMetricsHandler(baseInfoHandler);
        return commonMetricsHandlerChain;
    }
}
